import request from '../utils/request'

export function getRoleList (page) {
  return request({
    url: '/role/list',
    method: 'get',
    params: page
  })
}

export function getRoleListOptions () {
  return request({
    url: '/role/options',
    method: 'get'
  })
}

export function getRoleInfo (roleId) {
  return request({
    url: `/role/info/${roleId}`,
    method: 'get'
  })
}

export function insertRole (role) {
  return request({
    url: '/role/insert',
    method: 'post',
    data: role
  })
}

export function deleteRole (role) {
  return request({
    url: '/role/delete',
    method: 'delete',
    data: role
  })
}

export function resetRole (Role) {
  return request({
    url: '/role/reset',
    method: 'post',
    data: Role
  })
}

export function updateRole (Role) {
  return request({
    url: '/role/update',
    method: 'put',
    data: Role
  })
}

export function bindUserRole (data) {
  return request({
    url: '/role/bind/user',
    method: 'post',
    data: data
  })
}

export function deleteUserRole (data) {
  return request({
    url: '/role/bind/user',
    method: 'delete',
    data: data
  })
}

export function getRoleListByUserId (userId) {
  return request({
    url: `/role/bind/user/${userId}`,
    method: 'get'
  })
}

export function getRoleNameListByUserId (userId) {
  return request({
    url: `/role/bind/user/name/${userId}`,
    method: 'get'
  })
}
